<template>
  <div class="custom_page">
    <div class="content">
      <!-- 顶部搜索 -->
      <div class="toolbar">
        <!-- 顶部搜索 -->
        <el-form :inline="true" :model="formInline">
          <el-form-item label="用户名称">
            <el-input v-model="formInline.userName" placeholder="请输入" />
          </el-form-item>
          <el-form-item label="用户手机号">
            <el-input v-model="formInline.phone" placeholder="请输入" />
          </el-form-item>
          <el-form-item label="会员单号">
            <el-input v-model="formInline.vipCode" placeholder="请输入" />
          </el-form-item>
          <el-form-item label="会员订单状态">
            <el-select v-model="formInline.payStatus" placeholder="请选择">
              <el-option label="全部" :value="null" />
              <el-option label="未支付" value="0" />
              <el-option label="已付款" value="1" />
            </el-select>
          </el-form-item>
          <el-form-item label-width="0">
            <el-button type="primary" plain @click="search">查询</el-button>
            <el-button plain @click="clear">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
      <!--  表格 -->
      <div class="content_table">
        <div class="table">
          <el-table
            :data="tableData"
            border
            :header-cell-style="{ background: '#EEF3FF', color: '#333333' }"
            style="width: 100%"
          >
            >
            <el-table-column prop="vipCode" label="会员单号" />
            <el-table-column prop="userName" label="用户名称" />
            <el-table-column prop="phone" label="手机号码" />
            <el-table-column prop="vipMonth" label="开通月数" />
            <el-table-column label="处理状态">
              <template slot-scope="scope">
                <span v-if="scope.row.vipType == 1">黄金会员</span>
                <span v-if="scope.row.vipType == 2">白银会员</span>
              </template>
            </el-table-column>
            <el-table-column prop="price" label="会员金额" />
            <el-table-column prop="payAmt" label="支付金额" />
            <el-table-column label="支付方式">
              <template slot-scope="scope">
                <span v-if="scope.row.payType == 1">微信</span>
                <span v-if="scope.row.payType == 2">支付宝</span>
              </template>
            </el-table-column>
            <el-table-column label="支付状态">
              <template slot-scope="scope">
                <span v-if="scope.row.status == 0">未支付</span>
                <span v-if="scope.row.status == 1">已支付</span>
              </template>
            </el-table-column>
            <el-table-column prop="tickCommodity" label="勾选商品" />
            <el-table-column prop="createTime" label="下单时间" />
            <el-table-column prop="payTime" label="支付时间" />
          </el-table>
          <div class="fenye">
            <el-pagination
              :current-page="currentPage"
              :page-sizes="[10, 20, 50, 100]"
              :page-size="10"
              layout="total, sizes, prev, pager, next, jumper"
              :total="total"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
            />
          </div>
        </div>
      </div>
    </div>

  </div>
</template>

<script>
// import { getShopId } from '@/utils/auth'
import {
  applicationGetAll
} from '@/api/viporder'

export default {
  data() {
    return {
      formInline: {
        userName: '', // 用户名称
        phone: '', // 手机号码
        vipCode: '', // 会员单号
        payStatus: null, // 支付状态
        page: 1,
        pageSize: 10
      },
      total: 1,
      tableData: [],
      currentPage: 1
    }
  },
  created() {
    this.getAll(this.formInline)
  },
  methods: {
    handleSizeChange(val) {
      this.formInline.pageSize = val
      this.getAll(this.formInline)
    },
    handleCurrentChange(val) {
      this.formInline.page = val
      this.getAll(this.formInline)
    },
    // 查询
    search() {
      this.total = 1
      this.formInline.page = 1
      this.getAll(this.formInline)
    },
    // 清除
    clear() {
      this.formInline = {
        userName: '', // 用户名称
        phone: '', // 手机号码
        vipCode: '', // 会员单号
        payStatus: null,
        page: 1,
        pageSize: 10
      }
      this.getAll(this.formInline)
    },

    // 初始化查询所有数据
    async getAll(formInline) {
      const res = await applicationGetAll(formInline)
      this.tableData = res.data.list
      this.total = res.data.total
    }
  }
}
</script>
<style lang='scss' scoped>
@import url("../../../styles/elDialog.scss");
.custom_page {
  padding: 20px;
}
.box {
  .dioBox {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    .inner {
      width: 50%;
      padding: 20px;
    }
  }
  .botTitle {
    color: red;
    text-align: center;
  }
}
</style>

